<template>
  <div>
    <!--我的展览-->
    <content-header :title="routeItem.title"></content-header>
    <div v-if="actList.length" class="xui-grid-avg-2 xui-padding-horizontal-children-sm xui-margin-top">
      <div class="xui-margin-bottom" v-for="(item,index) in actList" :key="index">
        <div class="creative-act-card" @click="showDetail(item)">
          <img-box :imgSrc="item.imgUrl" width="100%" height="230"></img-box>
          <div class="card-body">
            <h3 class="xui-text-truncate">{{item.title}}</h3>
            <span class="name color-gray">{{item.uname}}</span>
            <div class="xui-fc">
              <span v-if="$route.name == 'userCenter-myExhibition'" class="xui-fl color-gray xui-font-size-sm" :class="{'color-red':item.state == 2, 'color-green':item.state == 1}">{{TranState(item.state)}}</span>
              <span class="xui-fr color-gray">
                <i class="iconfont icon-dianzan"></i> {{item.agree}}</span>
              <span class="xui-fr color-gray xui-margin-right-md">
                <i class="iconfont icon-BAI-pinglun"></i> {{item.comment}}</span>
              <span class="xui-fr color-gray xui-margin-right-md">
                <i class="iconfont icon-eye"></i> {{item.browsNum}}</span>
            </div>
          </div>
          <!--转发-->
          <div class="forwording"></div>
        </div>
      </div>
    </div>
    <div v-else class="xui-margin-top-sm">暂无上传作品</div>

    <el-dialog title="作品详情" :visible.sync="dialogVisible" width="650px">
      <production :detail="artDetail"></production>
    </el-dialog>
  </div>
</template>
<script>
  import ContentHeader from "../../../components/widge/content-header";
  import ImgBox from "../../../components/widge/img-box";
  import pic from "@/assets/images/example/wenc.png";
  import {
    getMyExhibition
  } from "@/api/login";
  import production from "@/pages/exhibition/crowdFunding/production";

  export default {
    components: {
      ContentHeader,
      ImgBox,
      production
    },
    data() {
      return {
        actList: [],
        artDetail: {},
        dialogVisible: false
      };
    },
    computed: {
      routeItem() {
        let routes = this.$store.getters.siteMap;
        let result;
        routes.forEach(route => {
          if (route.children) {
            route.children.forEach(child => {
              if (child.name == this.$route.name) {
                result = child;
              }
            });
          }
        });
        return result;
      },
      routePath() {
        return this.$route.path;
      }
    },

    methods: {
      getMyExhibition() {
        let userId = this.$store.getters.userId;
        getMyExhibition(userId).then(res => {
          this.actList = res.data.recordsList;
        });
      },
      showDetail(detail) {
        this.artDetail = detail;
        this.dialogVisible = true;
      },
      TranState(statusId) {
        let result = '';
        if (statusId == 0) return '待审核'
        if (statusId == 1) return '审核通过'
        if (statusId == 2) return '审核不通过'
      }
    },
    mounted() {
      this.getMyExhibition();
    }
  };

</script>

<style lang="less" scoped>
  .xui-grid-avg-2.xui-padding-horizontal-children-sm {
    margin-left: -5px;
    margin-right: -5px;
  }

  .creative-act-card {
    border: 1px solid #d2d2d2;
    transition: border-color 0.25s;
    position: relative;
    cursor: pointer;
    .card-body {
      padding: 10px 15px;
      position: relative;
      height: 76px;
      .name {
        position: absolute;
        right: 16px;
        top: 14px;
        font-size: 14px;
      }
      h3 {
        font-size: 17px;
        margin-bottom: 4px;
        width: 320px;
      }
      span {
        font-size: 12px;
        i {
          vertical-align: middle;
        }
      }
    }
    .forwording {
      width: 36px;
      height: 36px;
      position: absolute;
      right: 0;
      top: 0;
      background: url("../../../assets/images/Winchance/zhuanfa.png") no-repeat 0% 100%;
    }
  }

  .creative-act-card:hover {
    border-color: #bf9c51;
  }

</style>
